﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterALSafa.Master" AutoEventWireup="true"
    CodeBehind="TE_Question_Bank_answer.aspx.cs" Inherits="School.Pages.Teaching.TE_Question_Bank_answer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script language="javascript" type="text/javascript">
        function CheckOtherIsCheckedByGVID(spanChk) {
            var IsChecked = spanChk.checked;
            if (IsChecked) {
                spanChk.parentElement.parentElement.style.backgroundColor = '#228b22';  // grdEmployees.SelectedItemStyle.BackColor
                spanChk.parentElement.parentElement.style.color = 'white'; // grdEmployees.SelectedItemStyle.ForeColor
            }
            //ContentPlaceHolder1_gvBank_A
            var CurrentRdbID = spanChk.id;
            var Chk = spanChk;

            //Parent = Chk.form.elements;	
            Parent = document.getElementById('ContentPlaceHolder1_gvBank_A');
            //alert(Parent.rows.length)
            var items = Parent.getElementsByTagName('input');

            for (i = 0; i < items.length; i++) {
                if (items[i].id != CurrentRdbID && items[i].type == "radio") {
                    if (items[i].checked) {
                        items[i].checked = false;
                        items[i].parentElement.parentElement.style.backgroundColor = 'white'; //grdEmployees.ItemStyle.BackColor
                        items[i].parentElement.parentElement.style.color = 'black'; //grdEmployees.ItemStyle.ForeColor
                    }
                }
            }
        }
    </script>
    <table dir="rtl" style="width: 100%; float: right">
        <tr>
            <td>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <table align="right" dir="rtl" style="width: 100%; float: right">
                            <tr>
                                <td colspan="2" class="admintitle" align="center">
                                    ادخال بيانات
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    المجمع
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlCampus" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
                                        DataTextField="Name" DataValueField="Id" OnTextChanged="ddlCampus_TextChanged"
                                        Width="150px">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="ddlCampus"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    الشهاده
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlCertificate" runat="server" AppendDataBoundItems="True"
                                        AutoPostBack="True" DataTextField="Name" DataValueField="Id" OnSelectedIndexChanged="ddlCertificate_SelectedIndexChanged"
                                        Width="150px" TabIndex="1">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="ddlCertificate"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    المرحله
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlStadge" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
                                        DataTextField="Name" DataValueField="Id" OnSelectedIndexChanged="ddlStadge_SelectedIndexChanged"
                                        Width="150px" TabIndex="2">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="ddlStadge"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    الصف
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlGrade" runat="server" AppendDataBoundItems="True" DataTextField="Name"
                                        DataValueField="Id" Width="150px" TabIndex="3" AutoPostBack="True" OnSelectedIndexChanged="ddlGrade_SelectedIndexChanged">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddlGrade"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    المادة
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlsubject" runat="server" AppendDataBoundItems="True" DataTextField="Sub_name"
                                        DataValueField="Id" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlsubject_SelectedIndexChanged">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="ddlsubject"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    السؤال
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlQuestion" runat="server" AppendDataBoundItems="True" DataTextField="Question"
                                        DataValueField="Id" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlQuestion_SelectedIndexChanged">
                                        <asp:ListItem Value="0">اختيار</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ControlToValidate="ddlQuestion"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" InitialValue="0" ValidationGroup="st"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    الإجابة
                                </td>
                                <td>
                                    <asp:TextBox ID="txtanswer" runat="server" TextMode="MultiLine"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" ControlToValidate="txtanswer"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red" ValidationGroup="a"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td nowrap="nowrap">
                                    &nbsp;
                                </td>
                                <td>
                                    <asp:Button ID="btnSave" runat="server" CssClass="graybutton" Text="اضافة" OnClick="btnSave_Click"
                                        ValidationGroup="st" />
                                    &nbsp;
                                    <asp:Label ID="lbltst" runat="server" Visible="False"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td align="right">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="plOnechoice" runat="server" Visible="False">
                            <asp:GridView ID="gvBank_A" runat="server" AllowPaging="True" AlternatingRowStyle-CssClass="GridItemAltername"
                                AutoGenerateColumns="False" CssClass="Grid" DataKeyNames="Id" FooterStyle-CssClass="GridHeaderFooter"
                                HeaderStyle-CssClass="GridHeaderFooter" PagerStyle-CssClass="GridPager" OnPageIndexChanging="gvBank_A_PageIndexChanging"
                                OnRowCancelingEdit="gvBank_A_RowCancelingEdit" OnRowDataBound="gvBank_A_RowDataBound"
                                OnRowDeleting="gvBank_A_RowDeleting" OnRowEditing="gvBank_A_RowEditing" OnRowUpdating="gvBank_A_RowUpdating"
                                Width="80%" ShowFooter="True" OnRowCommand="gvBank_A_RowCommand">
                                <AlternatingRowStyle CssClass="GridItemAltername" />
                                <Columns>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            م
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:RadioButton ID="chcoice" runat="server" onclick="javascript:CheckOtherIsCheckedByGVID(this);" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="الاجابة" SortExpression="Choices">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txt_answ_E" runat="server" Text='<%# Bind("Choices") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="txt_answ_E"
                                                Display="Dynamic" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Choices") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:CommandField CancelText="إلغاء" EditText="تعديل" ShowEditButton="True" UpdateText="تحــديث" />
                                    <asp:TemplateField ShowHeader="False">
                                        <FooterTemplate>
                                            <asp:Button ID="save" runat="server" CssClass="graybutton" OnClick="save_Click" Text="حفظ"
                                                ValidationGroup="st" />
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lkdelete" runat="server" CausesValidation="False" CommandName="Delete"
                                                Text="حذف"></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                </Columns>
                                <FooterStyle CssClass="GridHeaderFooter" />
                                <HeaderStyle CssClass="GridHeaderFooter" />
                                <PagerStyle CssClass="GridPager" />
                            </asp:GridView>
                        </asp:Panel>
                        <asp:Panel ID="plMulti" runat="server" Visible="False">
                            <asp:GridView ID="gvMultiChoice" runat="server" AllowPaging="True" AlternatingRowStyle-CssClass="GridItemAltername"
                                AutoGenerateColumns="False" CssClass="Grid" DataKeyNames="Id" FooterStyle-CssClass="GridHeaderFooter"
                                HeaderStyle-CssClass="GridHeaderFooter" PagerStyle-CssClass="GridPager" OnRowDataBound="gvBank_A_RowDataBound"
                                Width="80%" ShowFooter="True" OnPageIndexChanging="gvMultiChoice_PageIndexChanging"
                                OnRowCancelingEdit="gvMultiChoice_RowCancelingEdit" OnRowDeleting="gvMultiChoice_RowDeleting"
                                OnRowEditing="gvMultiChoice_RowEditing" OnRowUpdating="gvMultiChoice_RowUpdating">
                                <AlternatingRowStyle CssClass="GridItemAltername" />
                                <Columns>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            م
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chcoice" runat="server" />
                                            <%--   <asp:RadioButton ID="chcoice" runat="server" onclick="javascript:CheckOtherIsCheckedByGVID(this);" />--%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="الاجابة" SortExpression="Choices">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txt_answ_E" runat="server" Text='<%# Bind("Choices") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="txt_answ_E"
                                                Display="Dynamic" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Choices") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:CommandField CancelText="إلغاء" EditText="تعديل" ShowEditButton="True" UpdateText="تحــديث" />
                                    <asp:TemplateField ShowHeader="False">
                                        <FooterTemplate>
                                            <asp:Button ID="save_Multi" runat="server" CssClass="graybutton" OnClick="save_Multi_Click"
                                                Text="حفظ" ValidationGroup="st" />
                                        </FooterTemplate>
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lkdelete" runat="server" CausesValidation="False" CommandName="Delete"
                                                Text="حذف"></asp:LinkButton>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                </Columns>
                                <FooterStyle CssClass="GridHeaderFooter" />
                                <HeaderStyle CssClass="GridHeaderFooter" />
                                <PagerStyle CssClass="GridPager" />
                            </asp:GridView>
                        </asp:Panel>
                        <%--<asp:Panel ID="pltruefalse" runat="server" Visible="False">
                            <table width="80%">
                                <tr>
                                    <td>
                                    </td>
                                    <td nowrap="nowrap">
                                        <asp:RadioButtonList ID="rdbtruefalse" runat="server" RepeatDirection="Horizontal">
                                            <asp:ListItem Value="1">صح</asp:ListItem>
                                            <asp:ListItem Value="2">خطأ</asp:ListItem>
                                        </asp:RadioButtonList>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" ControlToValidate="rdbtruefalse"
                                            Display="Dynamic" ErrorMessage="*" ForeColor="Red" ValidationGroup="s"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                        <asp:Button ID="btntrufalseSave" runat="server" Text="حفــــظ" CssClass="graybutton"
                                            OnClick="btntrufalseSave_Click" ValidationGroup="st" />
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>--%>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>
